package com.setup.trac.controller.common.loaders;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.setup.trac.pojo.Societa;
import com.setup.trac.service.SearchService;

public class LoadClienti implements HttpObjectsLoader {
	private SearchService searchService ;

	public void load(HttpServletRequest request, HttpServletResponse response) {
		if(request.getSession(false).getAttribute("clienti")==null){
			Societa[] clienti= getSearchService().find(new Societa[0], Societa.class);
			request.getSession(false).setAttribute("clienti", clienti);
		}
	}

	public SearchService getSearchService() {
		return searchService;
	}

	public void setSearchService(SearchService searchService) {
		this.searchService = searchService;
	}

}
